﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CompanyMemberManage.aspx.cs" Inherits="SDLITS.Web.SystemManage.CompanyMemberManage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>企业卡管理</title>
    <link href="../js/uploadify/uploadify.css" rel="stylesheet" type="text/css" />
    <script src="../js/jquery-1.4.1.min.js" type="text/javascript"> </script>
    <script type="text/javascript" src="../js/uploadify/jquery.uploadify-3.1.min.js"></script>
    <style type="text/css">
        .customlabel span {
            color: red;
            font-weight: bold;
        }

        .marginright {
            margin-right: 15px;
        }
    </style>
    <script>
        function byId(id) {
            return document.getElementById(id);
        }
        function Init() {
            var obj = byId("CardReader1");
            //设置端口号，1表示串口1，2表示串口2，依此类推；1001表示USB，依此类推。
            obj.setPortNum(0);
        }
    </script>
</head>
<body onload="Init()">
    <object id="CardReader1" codebase="../FirstActivex.cab#version=1,3,3,1" classid="CLSID:F225795B-A882-4FBA-934C-805E1B2FBD1B" width="0" height="0">
        <param name="_Version" value="65536" />
        <param name="_ExtentX" value="2646" />
        <param name="_ExtentY" value="1323" />
        <param name="_StockProps" value="0" />
        <param name="port" value="串口1" />
        <param name="PhotoPath" value="" />
        <param name="ActivityLFrom" value="" />
        <param name="ActivityLTo" value="" />
    </object>
    <form id="form1" runat="server">

        <f:PageManager ID="PageManager1" runat="server" AutoSizePanelID="Panel1" />
        <f:Panel ID="Panel1" BodyPadding="5px" runat="server" AutoScroll="true" EnableCollapse="false" Title="企业卡管理" ShowBorder="false">
            <Toolbars>
                <f:Toolbar ID="spanActions" runat="server">
                    <Items>
                        <f:DropDownList runat="server" ID="cmbCompanyRoom" AutoPostBack="true" OnSelectedIndexChanged="cmbCompanyRoom_SelectedIndexChanged"></f:DropDownList>
                        <f:ToolbarSeparator runat="server"></f:ToolbarSeparator>
                        <f:Button runat="server" ID="lbtnAddCard" Hidden="true" OnClick="lbtnAddDriverCard_Click" Text="办理企业卡"></f:Button>
                        <f:ToolbarSeparator runat="server"></f:ToolbarSeparator>
                        <f:Button runat="server" ID="lbtnModifyCard" Hidden="true" OnClick="lbtnModifyCard_Click" Text="更新卡"></f:Button>
                        <f:ToolbarSeparator runat="server"></f:ToolbarSeparator>
                        <f:Button runat="server" ID="lbtnFreeCard" Hidden="true" OnClick="lbtnFreeCard_Click" Text="销卡"></f:Button>
                        <f:ToolbarSeparator runat="server"></f:ToolbarSeparator>
                        <f:Button runat="server" ID="lbtnSubmit" Hidden="true" OnClick="lbtnSubmitDriver_Click" Text="提交"></f:Button>
                        <f:ToolbarSeparator runat="server"></f:ToolbarSeparator>
                        <f:Button runat="server" ID="Button1" OnClick="Button1_Click" Text="取消"></f:Button>
                    </Items>
                </f:Toolbar>
            </Toolbars>
            <Items>
                <f:GroupPanel ID="GroupPanel5" Hidden="true" Title="卡功能" runat="server" Height="55px" Width="800px" EnableCollapse="false">
                    <Items>
                        <f:Panel ID="Panel2" Layout="Column" ShowHeader="false" ShowBorder="false" runat="server">
                            <Items>
                                <f:Button runat="server" ID="lbtnReadIDCard" OnClientClick="readCard()" CssClass="marginright" Text="读取身份证"></f:Button>
                                <f:Button runat="server" ID="lbtnWriteIDCard" OnClick="btnReset_Click" Text="输入身份证"></f:Button>
                            </Items>
                        </f:Panel>
                    </Items>
                </f:GroupPanel>
                <f:GroupPanel runat="server" Title="个人身份证信息" Hidden="true" ID="spanIdentity" Width="800px" EnableCollapse="True">
                    <Items>
                        <f:Panel ID="Panel3" runat="server" Height="170px" Width="800px" ShowBorder="false" ShowHeader="false"
                            Layout="HBox" BoxConfigAlign="Stretch" BoxConfigPosition="Start" BoxConfigChildMargin="0 40 0 0">
                            <Items>
                                <f:Panel ID="Panel4" Title="面板1" BoxFlex="1" runat="server" BodyPadding="5px" ShowBorder="false" ShowHeader="false">
                                    <Items>
                                        <f:SimpleForm ID="SimpleForm1" runat="server" LabelWidth="70px" ShowBorder="False" ShowHeader="False">
                                            <Items>
                                                <f:TextBox ID="lblIDNumber" Label="身份证号" runat="server"></f:TextBox>
                                                <f:TextBox ID="lblName" Label="姓名" runat="server"></f:TextBox>
                                                <f:TextBox ID="lblIDAddress" Label="地址" runat="server"></f:TextBox>
                                                <f:TextBox ID="lblSex" Label="性别" runat="server"></f:TextBox>
                                                <f:DatePicker runat="server" EnableEdit="false" DateFormatString="yyyy-MM-dd" Label="出生年月" ID="lblBirthday"></f:DatePicker>
                                            </Items>
                                        </f:SimpleForm>
                                    </Items>
                                </f:Panel>
                                <f:Panel ID="Panel5" Title="面板2" Width="350px" runat="server" BodyPadding="5px" ShowBorder="false" ShowHeader="false">
                                    <Items>
                                        <f:SimpleForm ID="SimpleForm5" runat="server" LabelWidth="80px" ShowBorder="False" ShowHeader="False">
                                            <Items>
                                                <f:Image Width="102px" Height="126px" runat="server" ID="imgIDShot" Label="身份证照片"></f:Image>
                                            </Items>
                                        </f:SimpleForm>
                                    </Items>
                                </f:Panel>
                            </Items>
                        </f:Panel>
                    </Items>
                </f:GroupPanel>
                <f:GroupPanel ID="spanDataList" Title="卡记录" Hidden="true" runat="server" Height="205px" Width="800px" EnableCollapse="false">
                    <Items>
                        <f:Panel ID="Panel6" Title="管理" ShowBorder="false" BodyPadding="0" ShowHeader="false" Layout="Fit" runat="server" AutoScroll="true">
                            <Items>
                                <f:Grid ID="Grid1" ShowBorder="false" PageSize="5" AllowPaging="true" EnableCheckBoxSelect="true" IsDatabasePaging="false"
                                    OnPageIndexChange="Grid1_PageIndexChange" OnRowDataBound="Grid1_RowDataBound" EnableColumnLines="true" EnableHeaderMenu="false" ShowHeader="false" Title="表格" Width="760px" runat="server"
                                    EnableCollapse="false" DataKeyNames="MemCardID" EnableTextSelection="true">
                                    <Columns>
                                        <f:RowNumberField EnablePagingNumber="true" Width="60px" TextAlign="Center" />
                                        <f:BoundField Width="100px" DataField="MemCardNo" HeaderText="卡号" />
                                        <f:BoundField Width="60px" DataField="StatusID" HeaderText="状态" />
                                        <f:BoundField Width="80px" DataField="RegistID" HeaderText="会员注册号" />
                                        <f:BoundField Width="80px" DataField="Name" HeaderText="会员名" />
                                        <f:BoundField Width="100px" DataField="StartDate" DataFormatString="{0:yyyy-MM-dd}" HeaderText="开始日期" />
                                        <f:BoundField Width="100px" DataField="ExpireDate" DataFormatString="{0:yyyy-MM-dd}" HeaderText="过期日期" />
                                    </Columns>
                                </f:Grid>
                            </Items>
                        </f:Panel>
                    </Items>
                </f:GroupPanel>
                <f:GroupPanel runat="server" Hidden="true" Title="个人信息" ID="dataPersonal" Width="800px" EnableCollapse="True">
                    <Items>
                        <f:Panel ID="Panel7" runat="server" Width="800px" ShowBorder="false" ShowHeader="false"
                            Layout="HBox" BoxConfigAlign="Stretch" BoxConfigPosition="Start" BoxConfigChildMargin="0 40 0 0">
                            <Items>
                                <f:Panel ID="Panel8" Title="面板1" BoxFlex="1" runat="server" BodyPadding="5px" ShowBorder="false" ShowHeader="false">
                                    <Items>
                                        <f:SimpleForm ID="SimpleForm2" runat="server" LabelWidth="70px" ShowBorder="False" ShowHeader="False">
                                            <Items>
                                                <f:TextBox ID="txtMemCardNo" AutoPostBack="true" OnTextChanged="txtMemCardNo_TextChanged" Label="出入卡号" runat="server"></f:TextBox>
                                                <f:Label runat="server" EncodeText="false" ID="lblCardLength"></f:Label>
                                                <f:TextBox ID="txtCell" Label="手机号码" runat="server"></f:TextBox>
                                                <f:Label runat="server" ID="lblStartDate" Label="开始日期"></f:Label>
                                                <f:Label runat="server" ID="lblExpireDate" Label="过期日期"></f:Label>
                                                <f:TextBox ID="txtPhone" Label="座机号码" runat="server"></f:TextBox>
                                                <f:Button runat="server" ID="btnCamer" Text="打开摄像头"></f:Button>
                                            </Items>
                                        </f:SimpleForm>
                                    </Items>
                                </f:Panel>
                                <f:Panel ID="Panel9" Title="面板2" Width="350px" runat="server" BodyPadding="5px" ShowBorder="false" ShowHeader="false">
                                    <Items>
                                        <f:SimpleForm ID="SimpleForm3" runat="server" LabelWidth="80px" ShowBorder="False" ShowHeader="False">
                                            <Items>
                                                <f:Image Width="102px" Height="226px" runat="server" ID="imgCam" Label="拍摄照片"></f:Image>
                                            </Items>
                                        </f:SimpleForm>
                                    </Items>
                                </f:Panel>
                            </Items>
                        </f:Panel>
                    </Items>
                </f:GroupPanel>
            </Items>
        </f:Panel>
        <f:HiddenField runat="server" ID="hidMapPath1"></f:HiddenField>
        <f:HiddenField runat="server" ID="hidMapPath1p"></f:HiddenField>
        <f:HiddenField runat="server" ID="hidIDShotTimesnap"></f:HiddenField>
        <f:HiddenField runat="server" ID="hidMapPath3"></f:HiddenField>
        <f:HiddenField runat="server" ID="hidMapPath3p"></f:HiddenField>
        <f:HiddenField runat="server" ID="hidCamShotTimesnap"></f:HiddenField>
        <f:HiddenField runat="server" ID="hidCamShotName"></f:HiddenField>
        <f:Window ID="Window1" Title="编辑" Hidden="true" EnableIFrame="true" runat="server"
            IFrameUrl="about:blank" IsModal="false" Width="800px" Height="500px">
        </f:Window>
        <f:Window ID="Window2" Title="编辑" Hidden="true" EnableIFrame="true" runat="server" Target="Parent" OnClose="Window2_Close"
            IsModal="True" Width="670px" Height="360px">
        </f:Window>
        <f:HiddenField runat="server" ID="hidCardInfo"></f:HiddenField>
        <f:Button runat="server" ID="hid_btn1" OnClick="hid_btn1_Click"></f:Button>
    </form>
</body>
</html>
<script type="text/javascript">
    var timesnap = '<%= hidIDShotTimesnap.ClientID %>';
    var mappath1p = '<%= hidMapPath1p.ClientID %>';
    var IDNumber = '<%= lblIDNumber.ClientID %>';
    var lblSex = '<%= lblSex.ClientID %>';
    var lblName = '<%= lblName.ClientID %>';
    var lblBirthday = '<%= lblBirthday.ClientID %>';
    var lblIDAddress = '<%= lblIDAddress.ClientID %>';

    function Disable() {
        $('#lbtnSubmitDup').attr('style', 'display:none;');
        $('#lbtnSubmit').attr('style', 'display:none;');
    }
    function init() {
        var obj = document.getElementById("CardReader1");
        obj.setPortNum(0);
    }
    function GetRealTime() {
        var myDate = new Date();
        return String(myDate.getFullYear()) + String(myDate.getMonth() + 1) +
                String(myDate.getDate()) + String(myDate.getHours()) + String(myDate.getMinutes()) +
                    String(myDate.getSeconds()) + String(myDate.getMilliseconds());
    }
    function readCard() {
        F("<%=hidIDShotTimesnap.ClientID%>").setValue(GetRealTime());
        var hidMapPath1p = F("<%=hidMapPath1p.ClientID%>").getValue();
        var hidIDShotTimesnap = F("<%=hidIDShotTimesnap.ClientID%>").getValue();
        var lblIDNumber = F("<%=lblIDNumber.ClientID%>").getValue();
        var filepath = hidMapPath1p;
        var obj = byId("CardReader1");
        obj.Flag = 0;
        //obj.PhotoPath = filepath;
        var rst = obj.ReadCard();
        var info = obj.CardNo() + "|" + obj.NameL() + "|" + obj.Address() + "|" + obj.SexL() + "|" + obj.Born();
        //  document.write(obj.PhotoPath);
        //  alert(obj.StrToJpg(obj.PhotoPath));
        // alert(info);
        F("<%=hidCardInfo.ClientID%>").setValue(info);
        __doPostBack('hid_btn1', '')
        //setTimeout(function () {
        //    __doPostBack('hid_btn1', '')
        //}, 1000);
    }
</script>
<%--<script type="text/javascript">
    var prm = Sys.WebForms.PageRequestManager.getInstance();
    prm.add_endRequest(DocumentReady);
</script>--%>